// components/confirmDialog.js
import Dialog from '@vant/weapp/dialog/dialog';
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    title:{
      type: String,
      value: ''
    },
    message:{
      type: String,
      value: ''
    },
    useSlot: {
      type: Boolean,
      value: false
    },
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    show(data){
      const _this = this;
      //console.log(data);
      Dialog.confirm({
        context: _this,
        title: _this.properties.title,
        message: _this.properties.message,
      })
      .then(() => {
        _this.triggerEvent('confirm', data);
      })
      .catch(() => {
        _this.triggerEvent('cancel', data);
      });
    }
  }
})
